#ifndef INFOASSEMBLING_H
#define INFOASSEMBLING_H

#include "laneitem.h"
#include "roadmapitem.h"
#include "mapinfo.h"
#include "roaditem.h"
#include "commondefine.h"
#include "roaddata.h"
#include "lane.h"

typedef QVector<QVector<QVector<SLane> > > RoadMapLane;
typedef QVector<QVector<SLane> > RoadLane;
typedef QVector<SLane> SectionLane;

class InfoAssembling
{
public:
    InfoAssembling();
    ~InfoAssembling();

    RoadMapItem* getMap();

    //转换
    RoadMapItem *transferRoadMapInfo(const MapInfo &mapInfo);
    void transferRoad(const SRoad &road, RoadItem *pRoadItem);
    void transferRoad(const SRoad &road, LaneItem *pLaneItem);
    void transferLaneSection(const SLaneSection &laneSection, LaneItem *pLaneItem);
    void transferLane(const SLane &lane, LaneItem *pLaneItem);
    void transferRoadID();
    void transferRoadType();
    void transferGeometryList();
    void transferELevationList();
    void transferLanesList(const MapInfo &mapInfo, RoadMapLane &roadMapLane);
    void transferJunctionRelation();
    void transferSignal();
    void transferObjects();
    void setRoadMapFilling(const RoadMapPaint &roadMapPaint, const RoadMapLane &roadMapLane, RoadMapItem *pRoadMapItem);
    void setRoadMapLaneLine(const RoadMapPaint &roadMapPaint, const RoadMapLane &roadMapLane, RoadMapItem *pRoadMapItem);

private:
    //初始化绘制地图的所有点
    void initRoadMapPoint(const QVector<Road> &qvecAllRoad);
    // 获取车道段数据
    LaneSectionPoint getLaneSectionPoint(LaneOffset &laneOffset, LaneSection &laneSection, QVector<Geometry> &vecGeometry, double dLaneStart, double dLaneEnd);
    LaneItem* createLaneItem(const QPolygonF &polygon, const QPolygonF &nextPolygon);
    QPolygonF getRoadShape(const RoadPoint &roadPoint);

    QVector<QVector<QVector<QPointF> > > m_qvecQvecQvecRoadLaesectionLaneData;
    QVector<QVector<QVector<Lane> > > m_vecRoadInformation;
    RoadMapPoint m_qvecRoadMapPoint;
    std::vector<std::vector<Lane> > m_vecVecLaneInformation;
    std::vector<int> m_vecLaneId;
    std::vector<int> m_vecRoadId;
    QMap<QString, int> m_qmapColor;
};


#endif // INFOASSEMBLING_H
